package com.zh.equipment.service.impl;


import com.zh.common.utils.ShiroUtils;
import com.zh.common.utils.StringUtil;
import com.zh.equipment.dao.EquipmentDao;
import com.zh.equipment.domain.EquipmentDO;
import com.zh.equipment.service.EquipmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;


@Service
public class EquipmentServiceImpl implements EquipmentService {
	@Autowired
	private EquipmentDao equipmentDao;
	
	@Override
	public EquipmentDO get(String id){
		return equipmentDao.get(id);
	}
	
	@Override
	public List<EquipmentDO> list(Map<String, Object> map){
		return equipmentDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return equipmentDao.count(map);
	}

	@Override
	public int save(EquipmentDO equipment){
		equipment.setId(StringUtil.generalKeyword());//自动生成的ID
		equipment.setCreateBy(ShiroUtils.getUserId());//更新人
		equipment.setCreateDate(new Date());//更新时间
		return equipmentDao.save(equipment);
	}

	@Override
	public int update(EquipmentDO equipment){
		equipment.setUpdateBy(ShiroUtils.getUserId());
		equipment.setUpdateDate(new Date());
		return equipmentDao.update(equipment);
	}
	
	@Override
	public int remove(String id){
		return equipmentDao.remove(id);
	}
	
	@Override
	public int batchRemove(String[] ids){
		return equipmentDao.batchRemove(ids);
	}

	@Override
	public List<EquipmentDO> select(EquipmentDO equipmentDO){return equipmentDao.select(equipmentDO);}
	
}
